#include <bits/stdc++.h>
using namespace std;
int a,b[100005],t,ans=0,Max=-1,Min=100005,y,the;
stack <int> s;
int read();
void write(int x);
int main()
{
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    a=read();
    for(int i=1;i<=a;i++){
        t=read();
        b[t]++;

        if(t<Min) Min=t;
    }
    s.push(Min);
    y=Min,the=0;
    while(!s.empty()){
        int k=s.top();
        s.pop();
        if(b[k]>the){
            b[k]-=the;
             int j=y+1;
            while(j<=100000){

                while(b[j]==0&&j<=100000){
                    j++;
                }
                if(j<=100000){
                    s.push(j);
                    //cout<<j<<endl;
                    if(b[k]>b[j]){
                        b[k]-=b[j];
                        j++;
                    }else{
                        the=b[j]-b[k];
                        b[k]=0;
                        y=j;
                        break;
                    }
                }
            }
            if(j>100000){
                ans=b[k];
                while(!s.empty()){

                    int h=s.top();
                    s.pop();
                    ans+=b[h];
                }
                write(ans);
                return 0;
            }
        }else{
            the-=b[k];
            b[k]=0;
        }
    }

    return 0;
}

int read(){
    int x,y=1;char c;
    while((c=getchar())>'9'||c<'0') if(c=='-') y=-1;
    x=(c^48);
    while((c=getchar())>='0'&&c<='9') x=(x<<3)+(x<<1)+(c^48);
    return x*y;
}

void write(int x){
    if(x<0) x=-x,putchar('-');
    if(x>9) write(x/10);
    putchar(x%10+48);

}
